$(function(){
	//表单提交事件
	$('#multipleUploadForm').submit(function(event) {

		var formElement = this;
		var formData = new FormData(formElement);

		$.ajax({
			type: "POST",
			enctype: 'multipart/form-data',
			url: "/file/uploadMultipleFiles",
			data: formData,
			processData: false,
			contentType: false,
			success: function (data) {
				$('#multipleFileUploadError').hide();
				alert("文件上传成功！");
				window.location.reload();
			},
			error: function (error) {
				console.log(error);
				$("#multipleFileUploadSuccess").hide();
				$("#multipleFileUploadError").html((error && error.message) || "Some Error Occurred");

				alert("文件上传失败！");
			}
		});

		event.preventDefault();
	});

	//查看文件列表
	$("#viewList").click(function(){
		$.ajax({
			type: "GET",
			data:{},
			url: "/file/getAppIndexImg",
			success: function (data) {
				var src=data.path;
				//var src="http://localhost:8080/image/logo-name.png"
				console.info(src);
				$("#img").append("<img src=\""+src+"\">");
            alert("success")
			},
			error: function (error) {
             alert("error")
			}
		});

	});
});


